﻿//*** Guidance generated code ***//
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;

using DocumentFormat.OpenXml.Wordprocessing;

using ProjectBase.Core;

namespace $safeprojectname$.Export.Word
{
    public class StringHandler : DocPartHandlerBase
    {
        /// <summary> 200, the first default handler</summary>
        public override int Priority { get { return 200; } }

        protected override HandlerResult HandleDocPart(DocPart currentPart, IPersistentObject entity, params string[] prefixes)
        {
            var name = currentPart.Name(prefixes);

            // string property
            string text;
            if (entity.TryGetResult(name, out text))
            {
                currentPart.InjectValue(text);
                return HandlerResult.Finished;
            }
            return HandlerResult.Continue;
        }
    }
}